package cn.alpha.workflow.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;

/**首页的controller*/
@Controller
@RequestMapping(value = "/portal")
public class IndexController {
	
	@RequestMapping(value = "/sidebarMenu")
	@ResponseBody
    public Object sidebarMenu() 
    {
		String str="[{\"pid\":\"\",\"id\":\"index\",\"href\":\"#!index\",\"className\":\"icon-dashboard\",\"name\":\"控制台\"},"+
				"    {\"pid\":\"\",\"id\":\"DEMO\",\"href\":\"#!#\",\"className\":\"icon-desktop\",\"name\":\"DEMO\",\"children\":["+
                "        {\"pid\":\"\",\"id\":\"ztree\",\"href\":\"#!ztree\",\"className\":\"icon-double-angle-right\",\"name\":\"zTree\"},"+
                "        {\"pid\":\"\",\"id\":\"iframeBD\",\"href\":\"#!iframeBD?src=http://www.baidu.com\",\"className\":\"icon-double-angle-right\",\"name\":\"内嵌iframe-BD\"},"+
                "        {\"pid\":\"\",\"id\":\"iframeIN\",\"href\":\"#!iframeIN?src=/portal/jquery-ui.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"内嵌iframe-站内\"}"+
                "    ]},"+
                "    {\"pid\":\"\",\"id\":\"model\",\"href\":\"#!model\",\"className\":\"icon-desktop\",\"name\":\"流程模型管理\"},"+
                "    {\"pid\":\"\",\"id\":\"procdef\",\"href\":\"#!procdef\",\"className\":\"icon-desktop\",\"name\":\"流程定义管理\"},"+
                "    {\"pid\":\"\",\"id\":\"procinst\",\"href\":\"#!procinst\",\"className\":\"icon-desktop\",\"name\":\"流程实例管理\"},"+
                "    {\"pid\":\"\",\"id\":\"typography\",\"href\":\"typography.jhtml\",\"className\":\"icon-text-width\",\"name\":\"文字排版\"},"+
                "    {\"pid\":\"\",\"id\":\"desktop2\",\"href\":\"#!#\",\"className\":\"icon-desktop\",\"name\":\"UI 组件\",\"children\":["+
                "        {\"pid\":\"\",\"id\":\"elements\",\"href\":\"elements.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"组件\"},"+
                "        {\"pid\":\"\",\"id\":\"buttons\",\"href\":\"buttons.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"按钮 &amp; 图表\"},"+
                "        {\"pid\":\"\",\"id\":\"treeview\",\"href\":\"treeview.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"树菜单\"},"+
                "        {\"pid\":\"\",\"id\":\"jquery-ui\",\"href\":\"jquery-ui.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"jQuery UI\"},"+
                "        {\"pid\":\"\",\"id\":\"nestable-list\",\"href\":\"nestable-list.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"可拖拽列表\"},"+
                "        {\"pid\":\"\",\"id\":\"three\",\"href\":\"#!#\",\"className\":\"icon-double-angle-right\",\"name\":\"三级菜单\",\"children\":["+
                "            {\"pid\":\"\",\"id\":\"leaf\",\"href\":\"#!#\",\"className\":\"icon-leaf\",\"name\":\"第一级\"},"+
                "            {\"pid\":\"\",\"id\":\"pencil\",\"href\":\"#!#\",\"className\":\"icon-pencil\",\"name\":\"第四级\",\"children\":["+
                "                {\"pid\":\"\",\"id\":\"plus\",\"href\":\"#!#\",\"className\":\"icon-plus\",\"name\":\"添加产品\"},"+
                "                {\"pid\":\"\",\"id\":\"eye-open\",\"href\":\"#!#\",\"className\":\"icon-eye-open\",\"name\":\"查看商品\"}"+
                "            ]}"+
                "        ]}"+
                "    ]},"+
                "    {\"pid\":\"\",\"id\":\"list\",\"href\":\"#!#\",\"className\":\"icon-list\",\"name\":\"表格\",\"children\":["+
                "        {\"pid\":\"\",\"id\":\"tables\",\"href\":\"tables.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"简单 &amp; 动态\"},"+
                "        {\"pid\":\"\",\"id\":\"jqgrid\",\"href\":\"jqgrid.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"jqGrid plugin\"}"+
                "    ]},"+
                "    {\"pid\":\"\",\"id\":\"edit\",\"href\":\"#!#\",\"className\":\"icon-edit\",\"name\":\"表单\",\"children\":["+
                "        {\"pid\":\"\",\"id\":\"form-elements\",\"href\":\"form-elements.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"表单组件\"},"+
                "        {\"pid\":\"\",\"id\":\"form-wizard\",\"href\":\"form-wizard.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"向导提示 &amp; 验证\"},"+
                "        {\"pid\":\"\",\"id\":\"wysiwyg\",\"href\":\"wysiwyg.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"编辑器\"},"+
                "        {\"pid\":\"\",\"id\":\"dropzone\",\"href\":\"dropzone.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"文件上传\"}"+
                "    ]},"+
                "    {\"pid\":\"\",\"id\":\"widgets\",\"href\":\"widgets.jhtml\",\"className\":\"icon-list-alt\",\"name\":\"插件\"},"+
                "    {\"pid\":\"\",\"id\":\"calendar\",\"href\":\"calendar.jhtml\",\"className\":\"icon-calendar\",\"name\":\"日历\"},"+
                "    {\"pid\":\"\",\"id\":\"gallery\",\"href\":\"gallery.jhtml\",\"className\":\"icon-picture\",\"name\":\"相册\"},"+
                "    {\"pid\":\"\",\"id\":\"icon-tag\",\"href\":\"#\",\"className\":\"icon-tag\",\"name\":\"更多页面\",\"children\":["+
                "        {\"pid\":\"\",\"id\":\"profile\",\"href\":\"profile.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"用户信息\"},"+
                "        {\"pid\":\"\",\"id\":\"inbox\",\"href\":\"inbox.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"收件箱\"},"+
                "        {\"pid\":\"\",\"id\":\"pricing\",\"href\":\"pricing.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"售价单\"},"+
                "        {\"pid\":\"\",\"id\":\"invoice\",\"href\":\"invoice.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"购物车\"},"+
                "        {\"pid\":\"\",\"id\":\"timeline\",\"href\":\"timeline.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"时间轴\"},"+
                "        {\"pid\":\"\",\"id\":\"login\",\"href\":\"login.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"登录 &amp; 注册\"}"+
                "    ]},"+
                "    {\"pid\":\"\",\"id\":\"file-alt\",\"href\":\"#\",\"className\":\"icon-file-alt\",\"name\":\"其他页面\",\"children\":["+
                "        {\"pid\":\"\",\"id\":\"faq\",\"href\":\"faq.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"帮助\"},"+
                "        {\"pid\":\"\",\"id\":\"error-404\",\"href\":\"error-404.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"404错误页面\"},"+
                "        {\"pid\":\"\",\"id\":\"error-500\",\"href\":\"error-500.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"500错误页面\"},"+
                "        {\"pid\":\"\",\"id\":\"grid\",\"href\":\"grid.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"网格\"},"+
                "        {\"pid\":\"\",\"id\":\"blank\",\"href\":\"blank.jhtml\",\"className\":\"icon-double-angle-right\",\"name\":\"空白页面\"}"+
                "    ]}]";                        
        return JSONObject.parse(str);
    }
	
	@RequestMapping(value = "/workspace")
    public String workspace() 
    {
        return "/portal/workspace";
    }
	
    @RequestMapping(value = "/index")
    public String index() 
    {
        return "/portal/index";
    }

    @RequestMapping(value = "/{page}")
    public String demo(@PathVariable String page) 
    {
        return "/demo/"+page;
    }

    
}
